package com.cn.stusy0015.demo0021;

import java.util.Scanner;
/**
 * @author lw
 * @ClassName Teststu001.java
 * @Description
 * @createTime 2023年05月21日 16:15:00
 */
public class Teststu001 {
    public static void main(String[] args) {
        Student[] s = new Student[20];
        StuData sds = new StuData();
        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < s.length; i++) {
            System.out.println("请输入第"+(i+1)+"个学生的信息：");
            System.out.print("请输入学号：");
            String sid = sc.next();
            System.out.print("请输入姓名：");
            String sname = sc.next();
            System.out.print("请输入年龄：");
            int age = sc.nextInt();
            System.out.print("请输入班级：");
            String cla = sc.next();
            s[i] = new Student();

            s[i].setSid(sid);
            s[i].setSname(sname);
            s[i].setAge(age);
            s[i].setCla(cla);
            sds.stuadd(s[i]);
            System.out.println("学生信息成功，是否继续？(y/n)");
            String flag = sc.next();
            if (flag.equals("y")) {
                continue;
            } else {
                break;
            }
        }
        sds.showStu();
    }
}
